const state = {
  cols: [],
  dataList: [],
  searchQuery: '',
  loading: false,
  url: '',
  mylist: {}
}

const getters = {
  initCols: state => {
    return state.cols
  },
  initDataList: state => {
    return state.dataList
  },
  searchQuery: state => {
    return state.searchQuery
  },
  'loading': state => {
    return state.loading
  }
}

const actions = {
  updateSearchQuery (store, value) {
    store.commit('updateSearchQuery', value)
  },
  'initListLoad' (store, list) {
    store.commit('initList', list)
  }
}

const mutations = {
  'loading' (store) {
    store.loading = !store.loading
  },
  'updateSearchQuery' (store, value) {
    store.searchQuery = value
  },
  'initList' (store, list) {
    state.dataList = list
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
